import { DialogForm } from 'custom/index'
import ShopList from '../components/ShopList.vue'
import { addCustomerConsultationRecord, updateCustomerConsultationRecord } from '../api'

const addDialog = new DialogForm('DialogForm')

addDialog
  .title('添加平台客户')
  .width('80%')
  .postApi(addCustomerConsultationRecord)
  .useGroup('基础信息')
    .useItem('customerName').label('客户名称').required().span(8).end()
    .useCustomItem(ShopList, 'shopList').label('').setDefault([]).end()

const editDialog = new DialogForm('DialogForm')

editDialog
  .title('编辑客户')
  .getApi(async (_, row) => row)
  .postApi(updateCustomerConsultationRecord)
  .useGroup()
    .useItem('customerNo').label('客户编号').setProp('disabled', true).end()
    .useItem('customerName').label('客户名称').required().end()

export { addDialog, editDialog }
